//
//  ZWDateFormatter.m
//  PhoneCall
//
//  Created by 张伟 on 2021/5/15.
//

#import "ZWDateFormatter.h"

static NSString *const kCurrentDateFormatter = @"currentDateFormatter";

@implementation ZWDateFormatter

+ (instancetype)shareFormatter {
    NSMutableDictionary *threadDict = [NSThread currentThread].threadDictionary;
    ZWDateFormatter *dateFormatter = threadDict[kCurrentDateFormatter];
        if (!dateFormatter) {
            @synchronized (self) {
                if (!dateFormatter) {
                    dateFormatter = [ZWDateFormatter new];
                    threadDict[kCurrentDateFormatter] = dateFormatter;
                    return dateFormatter;
                }
                return dateFormatter;
            }
        }
        return dateFormatter;
}

@end
